Setting Up Your Motors in WPILIB

TalonFX Motors

When using TalonFX Motors to initialize the motor and set the id you'll use "private final TalonFX "name" = new TalonFX("id of motor");".

private final TalonFX TalonFXMotor = new TalonFX(1);

TalonFXS Motors

Very similar to how you setup the TalonFX Motors except you add TalonFXS instead of TalonFX.

private final TalonFXS TalonFXSMotor = new TalonFXS(1);

Configurations for TalonFX Motors

Often abbreviated as "configs" all these do is pass configurations to the motors. Most often case use are current limits. To make a configuration for TalonFX motors just use "private final TalonFXConfiguration "name" = new TalonFXConfiguration();".

private final TalonFXConfiguration TalonFXConfig = new TalonFXConfiguration();

Configurations for TalonFXS Motors

Again very similar to how you setup configs for TalonFX Motors you just use TalonFXS instead of TalonFX.

private final TalonFXSConfiguration TalonFXSConfig = new TalonFXSConfiguration();

Applying Current Limits to TalonFX Configurations

You ALWAYS want a current limit on whatever motor you're using. To apply one all you have to add is ""Name of TalonFX Configuration".withSupplyCurrentLimit(40);". For most uses a current limit of 40 is good for a TalonFX motor but if you're not sure ask someone.

TalonFXConfig.withSupplyCurrentLimit(40);

Applying Current Limits to TalonFXS Configurations

Nothing changes in the code just use the TalonFXS config you made and not the TalonFX one. Since you'll mostly be using minions for TalonFXS configurations a good current limit is 15.

TalonFXSConfig.withSupplyCurrentLimit(15);

Applying TalonFX Motor Configs to TalonFX Motors

To apply your configs to your TalonFX Motors just use ""name of motor".getConfigurator().apply("name of talonfx config");"

TalonFXMotor.getConfigurator().apply(TalonFXConfig);

Applying TalonFXS Motor Configs to TalonFXS Motors

Same thing as TalonFX motors just use your TalonFXS configs and motors

TalonFXSMotor.getConfigurator().apply(TalonFXSConfig);

Running Your Motors in WPILIB

Running your motors like this should only be used for testing purposes and NEVER for actual competition unless you absolutely have to as the RPM your motor is spinning at will be inconsistent.

To run your motor all you have to do is add ""name of motor".set("speed of motor in percentage of max speed from 0-1");" to a command and call that command.

TalonFXMotor.set(0.5);
//0.5 will be 50% of the max speed of the motor
TalonFXMotor2.set(-0.5);
//Will run at 50% of max speed in reverse